package com.dodoke.common;

import lombok.Data;

@Data
public class Result {
    private int code;
    private String msg;
    private Object data;

    private Result() {}

    private Result(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success() {
        return new Result(200, "success", null);
    }

    public static Result success(Object data) {
        return new Result(200, "success", data);
    }

    public static Result success(String msg, Object data) {
        return new Result(200, msg, data);
    }

    public static Result success(int code, String msg, Object data) {
        return new Result(code, msg, data);
    }

    public static Result fail() {
        return new Result(400, "fail", null);
    }

    public static Result fail(Object data) {
        return new Result(400, "fail", data);
    }

    public static Result fail(String msg, Object data) {
        return new Result(400, msg, data);
    }

    public static Result fail(int code, String msg, Object data) {
        return new Result(code, msg, data);
    }
}
